package com.deri.readappliation.controller;

import com.deri.readappliation.entity.Dog;
import com.deri.readappliation.entity.Person;
import com.deri.readappliation.entity.TestEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class TestController {
    @Autowired
    private Person person;

    @Autowired
    private Dog dog;

    @Autowired
    private TestEntity testEntity;

    @RequestMapping("/tt")
    public Map<String, Object> test() {
        HashMap<String, Object> map = new HashMap<>();
        map.put("name", person.getLastName());
        map.put("age", person.getAge());
        map.put("birth", person.getBirth());
        map.put("maps", person.getMaps());
        map.put("lists", person.getLists());
        map.put("dog", person.getDog());
        return map;
    }

    @RequestMapping("/dog")
    public Map<String, Object> testDog() {
        HashMap<String, Object> map = new HashMap<>();
        map.put("name", dog.getName());
        map.put("age", dog.getAge());
        map.put("num", dog.getNum());
        return map;
    }

    @RequestMapping("/gateway")
    public Map<String, Object> testGateway() {
        HashMap<String, Object> map = new HashMap<>();
        map.put("routes", testEntity.getRoutes());
        return map;
    }
}
